package com.example.xinguanvue.service.impl;

import com.example.xinguanvue.bean.User;
import com.example.xinguanvue.mapper.UserMapper;
import com.example.xinguanvue.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {


    private UserMapper userMapper;

    @Autowired
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public PageInfo<User> listCourseByCategoryAndPage(Integer currentPage, Integer pageSize) {
        //-- 设置分页
        PageHelper.startPage(currentPage, pageSize);
        List<User> userList = userMapper.selectAllByPage();
        //-- 构建分页Bean对象PageInfo
        PageInfo<User> pageInfo = new PageInfo<>(userList);
        return pageInfo;
    }
}
